﻿using System;
using System.Windows;
using System.Windows.Data;

namespace VNet.VisiSuite.VisiCentral.Common.Converters
{
    public class InvertBooleanVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (parameter != null && parameter.ToString() == "Collapsed")
                return ((bool)value) ? Visibility.Collapsed : Visibility.Visible;

            return ((bool)value) ? Visibility.Hidden : Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return ((Visibility)value) == Visibility.Visible ? false : true;
        }
    }
}
